import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/mes-admin/vendor/page',
    method: 'get',
    params: {
      ...params,
      current,
      size
    }
  });
};

export const getDetail = (id) => {
  return request({
    url: '/api/mes-admin/vendor/detail',
    method: 'get',
    params: {
      id
    }
  });
};

export const remove = (ids) => {
  return request({
    url: '/api/mes-admin/vendor/remove',
    method: 'post',
    data: ids
  });
};

export const add = (row) => {
  return request({
    url: '/api/mes-admin/vendor/submit',
    method: 'post',
    data: row
  });
};

export const update = (row) => {
  return request({
    url: '/api/mes-admin/vendor/submit',
    method: 'post',
    data: row
  });
};

export const getPartnerList = (current, size, params) => {
  return request({
    url: '/api/mes-admin/partner/page',
    method: 'get',
    params: {
      ...params,
      current,
      size
    }
  });
};

export const addPartner = (row) => {
  return request({
    url: '/api/mes-admin/partner/submit',
    method: 'post',
    data: row
  });
};

export const getPartnerScmDefault = () => {
  return request({
    url: '/api/mes-admin/vendor/get-scm-default',
    method: 'get'
  });
};

export const checkScmTenant = (enterpriseCode) => {
  return request({
    url: '/api/mes-admin/vendor/get-scm-tenant-info?enterpriseCode=' + enterpriseCode,
    method: 'get'
  });
};
